package org.nahtanoj.contacts.sheet;

public class SheetError {

	private final Sheet s;

	public SheetError(Sheet s) {
		this.s = s;
	}

	public void addError(int row, String error) {
//		System.out.println("C:" + this.s.getValue("Validation", row));
//		System.out.println("E:" + error);
		String c = this.s.getValue("Validation",  row);
		if (c == null || c.length() == 0) {
			this.s.setValue("Validation",  row,  error);
		} else {
			this.s.setValue("Validation", row, c + "\n" + error);
		}
	}

	public void delError(int row) {
		s.setValue("Validation", row, "");
	}

	public void newError(int row, String error) {
		delError(row);
		addError(row, error);
	}
}
